package com.crawler

import com.alibaba.fastjson.JSON
import com.crawler.utils.HttpClientUtils

/**
  * Created by tongtao.zhu on 2017/3/31.
  */
object Test extends App {
  val list: String = HttpClientUtils.getInstance.sendHttpGet("http://poi-crawler-export-service01.gq:4080/invoke.json?url=http://service.dianping.com/poiService/HttpProxyExportService_1.0.0&method=queryCrawlerProxyInfo&parameterTypes=java.lang.String&parameters=5dfe6b30fac7788c&parameterTypes=long&parameters=60&parameterTypes=int&parameters=100&parameterTypes=int&parameters=200")

  var hostIp: String = null
  var hostPort: String = null
  var auth: String = null

  val array = JSON.parseArray(list)
  if (array.size() == 0){
  }
  for (i <- 0 to array.size()-1){
    val item: String = array.getString(i)
    val jsonObject = JSON.parseObject(item)
    hostIp = jsonObject.getString("hostIp")
    hostPort = jsonObject.getString("hostPort")
    val extInfo: String = jsonObject.getString("extInfo")
    auth = JSON.parseObject(extInfo).getString("a")
    println(hostIp+auth+hostPort)
  }
}
